(function(window) {
	var _templates=[];//模版库
	//模版组件加载函数
	var _load_templates_mobile=function(htmlss,pagevalue){
		var need=';';
		htmlss.forEach(function(template){
			if(!_templates[template.type] && need.indexOf(';'+template.type+';')<0){
				need+=template.type+';';
			}
		});
		if(need!=';'){
			var postdata={'plugin':'core','action':'tools.get_template','nosession':1};
			postdata.need=need;
			window.scope.ajax(postdata,'',function(res){
				if(res.common){
					angular.forEach(res.common,function(v,k){
						_templates[k]=v;
					});
				}
			},true);
		}
	}
	var _load_templates=function(htmlss,pagevalue){
		var need=';';
		var show_need=';';
		htmlss.forEach(function(htmls){
			//1.1、列表页相关模版加载
			
			if(htmls.type=='list'){
				if(!_templates.list_shows){
					//1.1.1、读取列表页数据类型模版
					need+='list_shows;list_edits;';
				}
				//1.1.2、读取列表页主模版
				if(!htmls.list.type){
					htmls.list.type='list';
				}
				if(!_templates[htmls.list.type]){
					need+=htmls.list.type+';';
				}
				//1.1.3、读取列表页简单搜索模版
				if(htmls.search_one){
					if(pagevalue=='modaldata' && !_templates.modal_search_one){
						need+='modal_search_one;';
					}
					if(pagevalue=="pagedata" && !_templates.search_one){
						need+='search_one;';
					}
				}
				//1.1.4、读取列表页筛选表单模版
				if(htmls.search){
					angular.forEach(htmls.search,function(ph){
						if(!_templates[ph.type] && need.indexOf(';'+ph.type+';')<0){
							need +=ph.type+';';
						}
					});
					if(need!=';'){
						need +='search_one;';
					}
				}
			}else if(htmls.type=='edit'){
				//1.2、读取编辑页相关模版
				if(htmls.edit){
					//1.2.1单编辑页转换为多编辑页
					htmls.edits=[{'title':htmls.desc,'list':htmls.edit}];
				}
				if(!htmls.edits){
					window.scope.message('编辑页未设置编辑内容，无法渲染！','error');
				}
				//1.2.2、读取编辑页表单模版
				angular.forEach(htmls.edits,function(edit){
					angular.forEach(edit.list,function(ph){
						if(!_templates[ph.type] && need.indexOf(';'+ph.type+';')<0){
							need+=ph.type+';';
						}
						if(ph.type=='array' && ph.details){
							if(!_templates.list_shows && need.indexOf(';list_shows;')<0){
								//1.1.1、读取列表页数据类型模版
								need+='list;list_shows;list_edits;';
							}
							angular.forEach(ph.details,function(p){
								if(!_templates[p.type] && need.indexOf(';'+p.type+';')<0){
									need=need+p.type+';';
								}
							});
						}
					});
				});
			}else if(htmls.type=='look'){
				
				angular.forEach(htmls.look,function(look){
					if((!_templates.looks || !_templates.looks[look.type]) && show_need.indexOf(';'+look.type+';')<0){
						show_need+=look.type+';';
					}
				});
			}else{
				if(!_templates[htmls.type]){
					need+=htmls.type+';';
				}
			}
		});
		if(need!=';' || show_need!=';'){
			var postdata={'plugin':'core','action':'tools.get_template','from_plugin':window.scope.page.plugin};
			if(need!=';'){
				postdata.need=need;
			}
			if(show_need!=';'){
				postdata.show_need=show_need;
			}
			window.scope.ajax(postdata,'',function(res){
				if(res.common){
					angular.forEach(res.common,function(v,k){
						_templates[k]=v;
					});
				}
				
				if(res.show){
					if(!_templates.looks){
						_templates.looks=[];
					}
					angular.forEach(res.show,function(v,g){
						_templates.looks[g]=v;
					});
				}
			},true);
		}
	}
	var made_page={};
	made_page.edit_html=function(htmls){
		if(!htmls.edits){
			window.scope.message('编辑页未设置编辑项','error');
		}
		var pagevalue=made_page.pagevalue;
		var edit_html='';
		var edit_tab_html='';
		//var edit_tabs=[];
		var first_tab=false;
		//遍历编辑框，生成编辑框表单代码
		angular.forEach(htmls.edits,function(edit){
			if(!edit.title){
				
				var html='<div class="form-horizontal modal-edit" style="background:#fff"><div class="modal-panel">';
			}else{
				//如果设置了编辑框标题，增加相应样式展现标题；如果设置了选项卡切换，增加编辑选项卡切换样式
				if(htmls.edit_tab){
					if(!first_tab){
						first_tab=edit.title;
					}
					if(edit.show){
						edit_tab_html+='<div ng-show="check_show('+pagevalue+'.item'+','+made_page.replace('"',"'",JSON.stringify(edit.show))+')" ng-class="{\'item\':1,\'on\':'+pagevalue+'.htmls.edit_tab==check_show_lang(\''+edit.title+'\')}"><a href="javascript:;" ng-click="pagedata.htmls.edit_tab=check_show_lang(\''+edit.title+'\')">{{check_show_lang("'+edit.title+'")}}</a></div>';
					}else{
						edit_tab_html+='<div ng-class="{\'item\':1,\'on\':'+pagevalue+'.htmls.edit_tab==check_show_lang(\''+edit.title+'\')}"><a href="javascript:;" ng-click="'+pagevalue+'.htmls.edit_tab=check_show_lang(\''+edit.title+'\')">{{check_show_lang("'+edit.title+'")}}</a></div>';
					}
					
					var html='<div class="panel form-horizontal" ng-show="'+pagevalue+'.htmls.edit_tab==check_show_lang(\''+edit.title+'\')"><div class="page-header" style="padding:0.2rem 0.5rem 0.5rem 0.5rem"><h4 class="syscolor">{{check_show_lang("'+edit.title+'")}}</h4></div><div class="panel-body weui_cells" style="margin-top:0">';
				}else{
					var html='<div class="panel form-horizontal"><div class="page-header" style="padding:0.2rem 0.5rem 0.5rem 0.5rem"><h4 class="syscolor">{{check_show_lang("'+edit.title+'")}}</h4></div><div class="panel-body weui_cells" style="margin-top:0">';
				}
			}
			//遍历编辑框表单项，生成相应代码
			angular.forEach(edit.list,function(ph){
				if(!_templates[ph.type]){
					window.scope.message('模版'+ph.type+'不存在3！','error');
					return false;
				}
				if(!ph.must){
					ph.must=false;
				}
				var temp=_templates[ph.type].template;
				//2.1.2、 生成关联代码和设置必填必填表单
				ph=made_page.set_default(ph,_templates[ph.type].default);
				ph.en_title=ph.en_title || '';
				if(ph.type=='array' && ph.details){
					//数组型数据处理
					var list=list_head='';
					angular.forEach(ph.list,function(d){
						if(!_templates.list_shows[d.type]){
							window.scope.message('模版'+d.type+'不存在1！','error');
							return false;
						}
						d.pagevalue=pagevalue;
						d=made_page.set_default(d,_templates.list.default.list[d.type]);
						t=_templates.list_shows[d.type];
						//遍历列表数组，生成列表代码
						t=made_page.combile(d,t);
						list+='<td>'+t+'</td>';
						list_head+='<th>{{check_show_lang("'+d.title+'")}}</th>';
					});
					ph.list=list;
					ph.list_head=list_head;
					var details=t='';
					angular.forEach(ph.details,function(d){
						if(!_templates[d.type]){
							window.scope.message('模版'+d.type+'不存在2！','error');
							return false;
						}
						t=_templates[d.type].template;
						d=made_page.set_default(d,_templates[d.type].default);
						if(!d.read){
							d.read=false;
						}
						if(d.show){
							d.guanlians=JSON.stringify(d.show);
							d.guanlians=made_page.replace('"',"'",d.guanlians);
							d.guanlians='ng-show="check_show(pagedata.current_field,'+d.guanlians+')"';
							d.show=undefined;
						}else{
							d.guanlians='';
						}
						d.moreclass='';
						d.tovalue='pagedata.current_field';
						//遍历表单参数数组，替换生成最终表单代码
						t=made_page.combile(d,t);
						details+=t;
					});
					ph.details=details;
					ph.count=ph.list.length+1;
				}
				if(ph.bitian){
					ph.moreclass='bitian';
					ph.bitian=undefined;
				}else{
					ph.moreclass='';
				}
				//2.1.3、 设置表单数据提交保存对象
				if(!ph.tovalue){
					if(edit.tovalue){
						ph.tovalue=pagevalue+'.item.'+edit.tovalue;
					}else{
						ph.tovalue=pagevalue+'.item';
					}
					
				}
				if(ph.show){
					ph.guanlians=JSON.stringify(ph.show);
					ph.guanlians=made_page.replace('"',"'",ph.guanlians);
					ph.guanlians='ng-show="check_show('+ph.tovalue+','+ph.guanlians+')"';
					ph.show=undefined;
				}else{
					ph.guanlians='';
				}
				if(!ph.read){
					ph.read=false;
				}
				ph.pagevalue=pagevalue;
				//遍历表单参数数组，替换生成最终表单代码
				temp=made_page.combile(ph,temp);
				html+=temp;
			});
			html+='</div></div>';
			edit_html+=html;

		});
		if(!htmls.submit_title){
			htmls.submit_title='提交_save';
		}
		if(htmls.show_last){
			htmls.show_last='true';
		}else{
			htmls.show_last='false';
		}
		if(!htmls.no_submit){
			//添加表单提交按钮
			if(htmls.post){
				if(htmls.post=='modal_result'){
					if(htmls.result_field){
						edit_html+='<div class="modal-sub"><button style="margin-right:10px;" ng-if="'+htmls.show_last+'" class="btn btn-primary" ng-click="goback()">{{check_show_lang("上一步","Previous step")}}</button><button  class="weui_btn weui_btn_primary" style="border-radius:1rem;" ng-click="modal_result('+pagevalue+'.item.'+htmls.result_field+')">{{check_show_lang(\''+htmls.submit_title+'\')}}</button></div>';
					}else{
						edit_html+='<div class="modal-sub"><button style="margin-right:10px;" ng-if="'+htmls.show_last+'" class="btn btn-primary" ng-click="goback()">{{check_show_lang("上一步","Previous step")}}</button><button  class="weui_btn weui_btn_primary" style="border-radius:1rem;" ng-click="modal_result('+pagevalue+'.item)">{{check_show_lang(\''+htmls.submit_title+'\')}}</button></div>';
					}
					
				}else{
					if(pagevalue=='modaldata'){
						edit_html+='<div class="modal-sub"><button style="margin-right:10px;" ng-if="'+htmls.show_last+'" class="btn btn-primary" ng-click="goback()">{{check_show_lang("上一步","Previous step")}}</button><button  class="weui_btn weui_btn_primary" style="border-radius:1rem;" ng-click="modal_post('+pagevalue+'.item,\''+htmls.post+'\')">{{check_show_lang(\''+htmls.submit_title+'\')}}</button></div>';
					}else{
						edit_html+='<div class="modal-sub"><button style="margin-right:10px;" ng-if="'+htmls.show_last+'" class="btn btn-primary" ng-click="goback()">{{check_show_lang("上一步","Previous step")}}</button><button  class="weui_btn weui_btn_primary" style="border-radius:1rem;" ng-click="check_form();post('+pagevalue+'.item,\''+htmls.post+'\')">{{check_show_lang(\''+htmls.submit_title+'\')}}</button></div>';
					}
					
				}
			}else{
				//兼容新型表单提交机制：表单提交至原op，由原op处理
				if(pagevalue=='modaldata'){
					edit_html+='<div class="modal-sub"><button style="margin-right:10px;" ng-if="'+htmls.show_last+'" class="btn btn-primary" ng-click="goback()">{{check_show_lang("上一步","Previous step")}}</button><button  class="weui_btn weui_btn_primary" style="border-radius:1rem;" ng-click="modal_post('+pagevalue+'.item,'+pagevalue+'.op)">{{check_show_lang(\''+htmls.submit_title+'\')}}</button></div>';
				}else{
					edit_html+='<div class="modal-sub"><button style="margin-right:10px;" ng-if="'+htmls.show_last+'" class="btn btn-primary" ng-click="goback()">{{check_show_lang("上一步","Previous step")}}</button><button  class="weui_btn weui_btn_primary" style="border-radius:1rem;" ng-click="check_form();post('+pagevalue+'.item,'+pagevalue+'.op)">{{check_show_lang(\''+htmls.submit_title+'\')}}</button></div>';
				}
				
			}
		}
		if(htmls.edit_tab && edit_tab_html){
			window.scope[pagevalue].htmls.edit_tab=first_tab;
			edit_tab_html='<div class="fui-tab-scroll">'+edit_tab_html+'</div>';
			edit_html=edit_tab_html+edit_html;
		}
		return edit_html;
	}
	made_page.list_html=function(htmls){
		var html='';
		var pagevalue=made_page.pagevalue;
		if(htmls.search){
			//3.1、筛选html
			var search_html='<div class="fui-cell-group" style="margin-top:0">';
			var keepGoing = true;
			angular.forEach(htmls.search,function(ph){
				//3.1.1、根据表单类型读取表单模版
				//console.log('_templates');console.log(_templates);
				if(ph.type=='string' && keepGoing){
					ph.type='search_one';
					_templates[ph.type]=_templates[ph.type]?_templates[ph.type]:{};
					var temp=_templates[ph.type].template;					
					ph=made_page.set_default(ph,_templates[ph.type].default);
					if(!ph.must){
						ph.must=false;
					}
					//3.1.2、 生成关联代码和设置必填必填表单
					var show=moreclass='';
					if(ph.show){
						show=JSON.stringify(ph.show);
						show=made_page.replace('"',"'",show);
						show='ng-show="check_show('+pagevalue+'.params,'+show+')"';
						ph.show=undefined;
					}
					temp=made_page.replace('{guanlians}',show,temp);
					if(ph.bitian){
						moreclass='bitian';
						ph.bitian=undefined;
					}
					temp=made_page.replace('{moreclass}',moreclass,temp);
					//3.1.3、 设置表单数据提交保存对象
					if(!ph.tovalue){
						ph.tovalue=pagevalue+'.params';
					}
					//遍历表单参数数组，替换生成最终表单代码
					temp=made_page.combile(ph,temp);
					search_html+=temp;
					keepGoing=false;
				}
			});
			if(search_html!='<div class="fui-cell-group" style="margin-top:0">'){
				if(pagevalue=='modaldata'){
					search_html+='</div>';
				}else{
					if(htmls.export){
						/*htmls.export_title=htmls.export_title || '导出';
						search_html+='<div class="pull-right">';
						search_html+='<button class="btn btn-gray" ><a ng-href="{{export(\''+htmls.export+'\',pagedata.params)}}"><i class="fa fa-file-excel-o"></i> '+htmls.export_title+'</a></button>';
						search_html+='</div>';*/
					}
					search_html+='</div>';
					
				}
				html+=search_html;
			}
		}
		//3.2、关键词查找表单
		if(htmls.search_one){
			if(pagevalue=='modaldata'){
				if(_templates.modal_search_one){
					var search_html=_templates.modal_search_one.template;
					var def=_templates.modal_search_one.default;
				}
			}else{
				if(_templates.search_one){
					var search_html=_templates.search_one.template;
					var def=_templates.search_one.default;
				}
			}
			htmls.search_one=made_page.set_default(htmls.search_one,def);
			search_html=made_page.combile(htmls.search_one,search_html);
			html+=search_html;
		}
		//4、 生成列表html
		if(htmls.list){
			//4.1、 初步检测参数是否合法
			var data=made_page.set_default(htmls.list,_templates[htmls.list.type].default);
			//4.4、 完成最后拼接并插入html
			var list_html=_templates[htmls.list.type].template;
			var lists='';
			var images='';
			var list_heads='';
			
			if(data.delall || data.batch.length>0){
				data.show_choose='true';
			}else{
				data.show_choose='false';
			}
			if(data.del_one || data.edit || data.action.length>0){
				data.show_action='true';
			}else{
				data.show_action='false';
			}
			if(data.list){
				angular.forEach(data.list,function(t){
					if(t.type){
						t=[t];
					}
					var t_temp='';
					var img_temp='';
					angular.forEach(t,function(td){
						if(td.show){
							td.guanlians=JSON.stringify(td.show);
							td.guanlians=made_page.replace('"',"'",td.guanlians);
							td.guanlians='ng-show="check_show(item,'+td.guanlians+')"';							
							td.show=undefined;
						}
						var temp='';
						if((td.set || (made_page.in_array(td.type,['href','modal','post','open']) && td.name)) && _templates.list_edits[td.type]){
							temp=_templates.list_edits[td.type];
						}else{
							temp=_templates.list_shows[td.type];
						}
						if(temp){
							temp=made_page.combile(td,temp);
						}
						if(td.type=='img_string' && td.img !='jy_nopic'){
							img_temp +='<img ng-src="{{tomedia(item.'+td.img+') ||\'../core/resource/images/nopic-small.jpg\'}}"/>'
						}
						if(td.type=='image'){
							img_temp +=temp;	
						}else{
							t_temp +=temp;
						}
					});
					images+=img_temp;	
					t[0].title=scope.check_show_lang(t[0].title);
					lists+='<div class="subtitle">'+t[0].title+'：'+t_temp+'</div>';			
				});
			}
			
			data.list=lists;
			data.list_head=list_heads;
			data.images=images;
			var actions='';
			if(data.action){
				angular.forEach(data.action,function(ac){
					if(ac.show){
						ac.guanlians=JSON.stringify(ac.show);
						ac.guanlians=made_page.replace('"',"'",ac.guanlians);
						ac.guanlians='ng-show="check_show(item,'+ac.guanlians+')"';
						ac.show=undefined;
					}
					if((ac.set || (made_page.in_array(ac.type,['href','modal','post','open']) && ac.name)) && _templates.list_edits[ac.type]){
						temp=_templates.list_edits[ac.type];
					}else{
						temp=_templates.list_shows[ac.type];
					}
					if(temp){
						temp=made_page.combile(ac,temp);
					}else{
						temp='';
					}
					actions+=temp;
				});
			}
			data.action=actions;
			/*
			var batchs='';
			if(data.batch){
				angular.forEach(data.batch,function(ac){
					if(ac.show){
						ac.guanlians=JSON.stringify(ac.show);
						ac.guanlians=made_page.replace('"',"'",ac.guanlians);
						ac.guanlians='ng-show="check_show(item,'+ac.guanlians+')"';
						ac.show=undefined;
					}
					if((ac.set || (made_page.in_array(ac.type,['href','modal','post','open']) && ac.name)) && _templates.list_edits[ac.type]){
						temp=_templates.list_edits[ac.type];
					}else{
						temp=_templates.list_shows[ac.type];
					}
					if(temp){
						temp=made_page.combile(ac,temp);
					}else{
						temp='';
					}
					batchs+=temp;
				});
				batchs=made_page.replace("{key}='+item.{key}","ids='+{pagevalue}.del",batchs);
			}
			data.batch=batchs;*/
			
			
			if(data.batch){
				data.batch=made_page.replace('"',"'",JSON.stringify(data.batch));
			}else{
				data.batch='[]';
			}
			if(pagevalue=='pagedata'){
				data.access='access';
			}else{
				data.access='access_modal';
			}
			list_html=made_page.combile(data,list_html);
			list_html=made_page.replace('{key}',data.key,list_html);
			html+=list_html;
		}
		return html;
	}
	made_page.look_html=function(htmls){
		var pagevalue=made_page.pagevalue;
		if(htmls.desc){
			var html='<div class="panel form-horizontal"><div class="page-header" style="padding:0.2rem 0.5rem 0.5rem 0.5rem"><h4 class="syscolor">{{check_show_lang(\''+htmls.desc+'\')}}</h4></div><div class="panel-body">';
		}else{
			var html='<div class="panel form-horizontal"><div class="panel-body">';
		}
		
		angular.forEach(htmls.look,function(ph){
			if(!_templates.looks[ph.type]){
				window.scope.message('模版'+ph.type+'不存在！','error');
				return false;
			}
			if(!ph.tovalue){
				ph.tovalue=pagevalue+'.item';
			}
			var temp=_templates.looks[ph.type].template;
			ph=made_page.set_default(ph,_templates.looks[ph.type].default);
			temp=made_page.combile(ph,temp);
			html+=temp;
		});
		html+='</div></div>';
		return html;
	}
	made_page.diy_html=function(htmls){
		var temp=_templates[htmls.type].template;
		var data=made_page.set_default(htmls,_templates[htmls.type].default);
		if(data.show){
			data.guanlians=JSON.stringify(data.show);
			data.guanlians=made_page.replace('"',"'",data.guanlians);
			data.guanlians='ng-show="check_show('+made_page.pagevalue+'.item,'+data.guanlians+')"';
			data.show=undefined;
		}else{
			data.guanlians='';
		}
		if(!data.tovalue){
			data.tovalue=made_page.pagevalue+'.item';
		}
		var html=made_page.combile(data,temp);
		return html;
	}
	made_page.set_default=function(data,def){
		if(!data || typeof(data)!='object'){
			return false;
		}
		if(!def || typeof(def)!='object'){
			return data;
		}
		angular.forEach(def,function(v,k){
			if(typeof(v)=='object'){
				//默认值为对象，分两种情况处理。
				if(!data[k]){
					if(v[0]){
						data[k]=v;
					}else{
						data[k]=[];
					}
				}else if(v[0]){
					//不分type处理方式
					angular.forEach(data[k],function(d,index){
						angular.forEach(v[0],function(v1,k1){
							if(d[k1]===undefined){
								if(v1=='bitian'){
									window.scope.message('生成页面时出错，关键参数未设置1！'+k1,'error');
									return false;
								}
								d[k1]=v1;
							}
						});
					});
				}else{
					//分type处理方式
					angular.forEach(data[k],function(d,index){
						if(!d[0]){
							angular.forEach(v[d.type],function(v1,k1){
								if(d[k1]===undefined){
									if(v1=='bitian'){
										window.scope.message('生成页面时出错，关键参数未设置！2'+k1,'error');
										return false;
									}
									d[k1]=v1;
								}
							});
						}else{
							angular.forEach(d,function(dd){
								angular.forEach(v[dd.type],function(v1,k1){
									if(dd[k1]===undefined){
										if(v1=='bitian'){
											window.scope.message('生成页面时出错，关键参数未设置！2'+k1,'error');
											return false;
										}
										dd[k1]=v1;
									}
								});
							});
						}
						
					});
				}
			}else{
				if(data[k]===undefined){
					data[k]=v;
				}
			}
		});
		return data;
	}
	made_page.combile=function(combile,str){
		if(!combile || typeof(combile)!='object'){
			window.scope.message('combile函数参数错误！'+combile,'error');
		}
		angular.forEach(combile,function(v,k){
			if(typeof(v)=='object'){
				v=JSON.stringify(v);
				v=made_page.replace('"',"'",v);
			}
			str=made_page.replace('{'+k+'}',v,str);
		});
		return str;
	}
	made_page.replace=function(search,replace,str){
		if(!str){
			return '';
		}
		if(search==replace){
			return str;
		}
		res=str.replace(search,replace);
		if(res!=str){
			res=made_page.replace(search,replace,res);
		}
		return res;
	}
	made_page.in_array=function(v,arr){
		var res=false;
		$.each(arr,function(i,d){
			if(d==v){
				res=true;
			}
		});
		return res;
	}
	made_page.windows=function(htmlss,pagevalue){
		_load_templates(htmlss,pagevalue);
		var page_html='';
		var temp='';
		var flex='';
		htmlss.forEach(function(htmls){
			if(!htmls.type){
				return;
			}
			if(!htmls.width){
				htmls.width='100%';
			}
			if(htmls.flex){
				flex='flex';
			}
			if(htmls.type=='edit'){
				temp=made_page.edit_html(htmls);
			}else if(htmls.type=='list'){
				temp=made_page.list_html(htmls);
			}else if(htmls.type=='look'){
				temp=made_page.look_html(htmls);
			}else{
				temp=made_page.diy_html(htmls);
			}
			var ueditor='<script type="text/javascript" src="../core/resource/components/ueditor/third-party/zeroclipboard/ZeroClipboard.js"></script><script type="text/javascript" src="../core/resource/components/ueditor/ueditor.config.js?v=20191210"></script><script type="text/javascript" src="../core/resource/components/ueditor/ueditor.all.min.js?v=20191212"></script><script type="text/javascript" src="../core/resource/components/ueditor/ueditor.parse.js?v=20191208"></script><script type="text/javascript" src="../core/resource/components/ueditor/lang/zh-cn/zh-cn.js?v=20190608"></script>';
			page_html+=ueditor+'<div class="col-jy" style="padding-bottom:0.3rem">'+temp+'</div>';
		});
		page_html='<div class="modal-page '+flex+'">'+ made_page.replace('{pagevalue}',pagevalue,page_html) + '</div>';
		//console.log('page_html');console.log(page_html);
		return page_html;
	}
	made_page.mobile=function(htmlss,pagevalue){
		_load_templates_mobile(htmlss.list,pagevalue);
		var page_html='<div class="fui-page fui-page-current"><div class="fui-header"><div class="fui-header-left" onclick="window.history.go(-1);"><a class="back"></a></div><div class="title">'+htmlss.title+'</div><div class="fui-header-right"></div></div><div class="fui-content navbar">';
		htmlss.list.forEach(function(htmls){
			if(!htmls.type){
				return;
			}
			page_html+=made_page.diy_html(htmls);
		});
		page_html+='</div></div><div class="fui-navbar" ng-if="{pagevalue}.htmls.menu"><a href="javascript:;" ng-repeat="menu in {pagevalue}.htmls.menu.list" ng-click="access_json(menu.url)" ng-class="{\'external nav-item\':1,\'active\':page.action+\'/\'==menu.url}"><span class="icon jinyunicon {{menu.icon}}"></span><span class="label" ng-style="{\'color\':{pagevalue}.htmls.menu.title_color || \'#000000\'}">{{menu.title}}</span></a></div>';
		page_html=made_page.replace('{pagevalue}',pagevalue,page_html);
		//console.log('page_html');console.log(page_html);
		return page_html;
	}
	made_page.made_page=function(htmlss,pagevalue){
		if(!htmlss || typeof(htmlss)!='object'){
			return htmlss;
		}
		made_page.pagevalue=pagevalue;
		if(htmlss.title && htmlss.list && !htmlss.type){
			htmlss.list.forEach(function(o){
				if(o.type=='list'){
					o.type='list_mobile';
				}
			});
			//console.log('旧版生成页面机制');
			return made_page.mobile(htmlss,pagevalue);
		}else{
			//console.log('新型生成页面机制');
			return made_page.windows(htmlss,pagevalue);
		}
	}
	if (typeof define === "function" && define.amd) {
		define(function(){
			return made_page;
		});
	} else {
		window.made_page = made_page;
	}
	
})(window);

	